<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>紧急救援短信系统</title>
<link href="css/ui-darkness/jquery-ui-1.10.2.custom.css"
	rel="stylesheet">
<script src="js/jquery-1.9.1.js"></script>
<script src="js/jquery-ui-1.10.2.custom.js"></script>
<script>
	$(function() {
		$("#submit").button();
		$("#radioset").buttonset();
		$("#grs_msg_ln").html($("textarea[name='grs.msg']").val().length);
		var msg = $("textarea[name='grs.msg']");
		msg.bind("keypress", function() {
			//console.log("----------------");
			msg.val(msg.val().substring(0, 70));
			$("#grs_msg_ln").html(msg.val().length);

		})
		//监听键盘，只允许输入数字和小数点
		$("input[name='grs.src']").keypress(function(event) {
			var keyCode = event.which;
			if (keyCode == 46 || (keyCode >= 48 && keyCode <= 57))
				return true;
			else
				return false;
		});
		//监听键盘，只允许输入数字和小数点
		$("input[name='grs.arfcn']").keypress(function(event) {
			var keyCode = event.which;
			if (keyCode == 46 || (keyCode >= 48 && keyCode <= 57))
				return true;
			else
				return false;
		});
		var arfcn = $("input[name='grs.arfcn']");
		arfcn.keypress(function(event) {
			var keyCode = event.which;
			if (keyCode == 46 || (keyCode >= 48 && keyCode <= 57))
				return true;
			else
				return false;
		});
		arfcn.keyup(function(event) {
			if (128 < parseInt(arfcn.val())) {
				console.log(arfcn.val());
				arfcn.val("");
			}
		})
		// Hover states on the static widgets
		$("#dialog-link, #icons li").hover(function() {
			$(this).addClass("ui-state-hover");
		}, function() {
			$(this).removeClass("ui-state-hover");
		});
	});
</script>
<style>
body {
	font: 100% "Trebuchet MS", sans-serif;
	margin: 50px;
}

.demoHeaders {
	margin-top: 2em;
}

#dialog-link {
	padding: .4em 1em .4em 20px;
	text-decoration: none;
	position: relative;
}

#dialog-link span.ui-icon {
	margin: 0 5px 0 0;
	position: absolute;
	left: .2em;
	top: 50%;
	margin-top: -8px;
}

#icons {
	margin: 0;
	padding: 0;
}

#icons li {
	margin: 2px;
	position: relative;
	padding: 4px 0;
	cursor: pointer;
	float: left;
	list-style: none;
}

#icons span.ui-icon {
	float: left;
	margin: 0 4px;
}

.fakewindowcontain .ui-widget-overlay {
	position: absolute;
}
</style>
</head>
<body>
	<div class="ui-widget">
		注意，本程序用于矿山救援。
		<s:fielderror></s:fielderror>
		<s:form action="setup!settingSubmit" theme="simple">
			<table>
				<tr>
					<td>发送号码</td>
					<td><s:textfield name="grs.src" label="发送号码" maxlength="12"
							title="位数不超过12位" /></td>
				</tr>
				<tr>
					<td>发送内容</td>
					<td><s:textarea name="grs.msg" label="发送内容" cols="20" rows="5"
							title="小于70个字符" /> <span id="grs_msg_ln">0</span></td>
				</tr>
				<tr>
					<td>当前频点</td>
					<td><s:textfield name="grs.arfcn" label="当前频点" title="小于128" /></td>
				</tr>
				<tr>
					<td>小区</td>
					<td><s:textfield label="小区" value="20000" disabled="true"
							title="默认20000" /></td>
				</tr>
			</table>
			<s:submit id="submit" value="设置" />
		</s:form>
	</div>
</body>
</html>